// ============================================================================
//
// Graph framework by Aurelien Moreau aurelien.moreau@gmail.com
// Modified by Pierre CHATEL chatelp@gmail.com
// Distributed under LGPL
// Copyright (C) Aurelien Moreau, 2008, 2009. All rights reserved
//
// ============================================================================

package com.thalesgroup.graphFramework.collections.iterator;

import java.util.Iterator;

public class ArrayIterator<T> implements Iterator<T>{

	private T[] array;
	private int index;
	
	public ArrayIterator(T[] array) {
		this.array=array;
		index=0;
	}
	
	public boolean hasNext() {
		return (array!=null)?index<array.length:false;
	}

	public T next() {
		if(array!=null && index<array.length) {
			return array[index++];
		} else {
			return null;
		}
	}

	public void remove() {
		throw new UnsupportedOperationException();
	}

}
